<template>
    <div class="followList">
        <el-table ref="multipleTable" :data="tableData" tooltip-effect="dark"
            style="width: 100%" @selection-change="handleSelectionChange">
            <el-table-column prop="type" label="类型" show-overflow-tooltip>
            </el-table-column>
            <el-table-column prop="title" label="标题" width="120">
            </el-table-column>
            <el-table-column prop="name" label="客户" show-overflow-tooltip>
            </el-table-column>
            <el-table-column prop="customer" label="联系人" show-overflow-tooltip>
            </el-table-column>
            <el-table-column prop="customer" label="手机" show-overflow-tooltip>
            </el-table-column>
            <el-table-column prop="customer" label="负责人" show-overflow-tooltip>
            </el-table-column>
            <el-table-column label="跟进日期" width="120">
                <template slot-scope="scope">{{ scope.row.date }}</template>
            </el-table-column>
            <el-table-column label="下次跟进" width="120">
                <template slot-scope="scope">{{ scope.row.date }}</template>
            </el-table-column>
            <el-table-column label="创建时间" width="120">
                <template slot-scope="scope">{{ scope.row.date }}</template>
            </el-table-column>
            <el-table-column prop="state" label="状态" show-overflow-tooltip>
                <template slot-scope="scope">
                    <el-tag disable-transitions type="primary"
                        v-if="scope.row.state == '新跟进'">{{
                            scope.row.state
                        }}</el-tag>
                    <el-tag disable-transitions type="success"
                        v-if="scope.row.state == '已完成'">{{
                            scope.row.state
                        }}</el-tag>
                             <el-tag disable-transitions type="warning"
                        v-if="scope.row.state == '进行中'">{{
                            scope.row.state
                        }}</el-tag>
                           <el-tag disable-transitions type="info"
                        v-if="scope.row.state == '已取消'">{{
                            scope.row.state
                        }}</el-tag>
                </template>
            </el-table-column>
            <el-table-column fixed="right" label="操作" align="center" width="180">
                <template slot-scope="scope">
                    <el-button type="primary" size="mini"
                        @click="goChange(scope.row.id)">
                        修改
                    </el-button>
                    <el-button type="danger" size="mini"
                        @click="deleteFollow(scope.row.id)">
                        删除
                    </el-button>
                </template>
            </el-table-column>
        </el-table>
        <!-- 分页器 -->
        <Pagination @getPagination="getPagination"></Pagination>
    </div>
</template>

<script>
import Pagination from '@/components/Pagination'
export default {
    name: '',
    data() {
        return {
            listTotal: [],
            tableData:
                [{
                    id: 1,
                    date: '2016-05-03',
                    name: '王小虎',
                    address: '上海市普陀区金沙江路 1518 弄',
                    state: '新跟进'
                }, {
                    id: 2,
                    date: '2016-05-02',
                    name: '王小虎',
                    address: '上海市普陀区金沙江路 1518 弄',
                    state: '新跟进'
                }, {
                    id: 3,
                    date: '2016-05-04',
                    name: '王小虎',
                    address: '上海市普陀区金沙江路 1518 弄',
                    state: '已完成'
                }, {
                    id: 4,
                    date: '2016-05-01',
                    name: '王小虎',
                    address: '上海市普陀区金沙江路 1518 弄',
                    state: '进行中'
                }, {
                    id: 5,
                    date: '2016-05-08',
                    name: '王小虎',
                    address: '上海市普陀区金沙江路 1518 弄',
                    state: '进行中'
                }, {
                    id: 5,
                    date: '2016-05-08',
                    name: '王小虎',
                    address: '上海市普陀区金沙江路 1518 弄',
                    state: '已取消'
                },
                ],
            multipleSelection: []

        }
    },
    components: {
        Pagination
    },
    methods: {
        //列表单选多选
        handleSelectionChange(val) {
            this.multipleSelection = val;
        },
        //进入修改页面
        goChange(id) {
            this.$router.push('/supply/supFollow/editFollow')
        },
        //删除供应商
        deleteFollow(id) {
            this.$confirm('此操作将删除该次跟进, 是否继续?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(() => {
                this.$message({
                    type: 'success',
                    message: '删除成功!'
                });
            }).catch(() => {
                this.$message({
                    type: 'info',
                    message: '已取消删除'
                });
            });
        },
        //获取点击的页码-------------------------------
        getPagination(page) {
            //   console.log('----',page);
            // this.currentPage = page;
            // if (this.searchStatus) {//点击了查询按钮---搜索数据---再点击分页
            //     //0-7  8 -15  page=1 2 3 
            //     console.log(page);
            //     this.tableData = this.listTotal.slice((page - 1) * 8, page * 8)
            //     return;
            // }
            //默认产品列表的分页功能

        }
    },


}



</script>

<style lang="less" scoped>

</style>